﻿<%@ Page Title="确认下单" Language="C#" MasterPageFile="~/Wap/Shop/ShopSite.Master" AutoEventWireup="true"
    CodeBehind="SubmitOrder.aspx.cs" Inherits="ZLCMS.Web.Wap.Shop.SubmitOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
	<style type="text/css">
		.Integral_Momey {
			display: inline-block;
			float: left;
			padding-left: 10px;
		}
		
		.ui-icon-carat-r:after {
			background: url(images/usercenter_righticon.png) no-repeat right center;
			background-size: contain;
		}
		
		.ui-content .ui-listview-inset,
		.ui-panel-inner>.ui-listview-inset {
			margin: 0;
			box-shadow: none;
		}
		
		.order_ok .order_okbox .right p {
			margin: 2px 0;
		}
		
		.ui-btn.ui-btn-icon-right.ui-icon-carat-r {
			color: #000;
			font-family: "微软雅黑";
			font-size: 14px;
		}
		
		.ui-btn.ui-btn-icon-right.ui-icon-carat-r span {
			color: #8e8e8e;
			margin-left: 10px;
		}
		
		.ui-btn.ui-corner-all.ui-btn-inherit.ui-btn-icon-left {
			color: #8e8e8e;
			font-family: "微软雅黑";
			font-weight: normal;
			background: none;
			border: none;
			font-size: 12px;
		}
		/** .order_ok
        {
            padding: 1em 1em 0;
        }*/
		
		.ui-controlgroup,
		fieldset.ui-controlgroup {
			margin: 0.5em 0 0;
		}
		
		#AddressList .ui-icon-carat-r:after {
			background: url(images/add_icon1.png) no-repeat right center;
			background-size: contain;
		}
		
		#AddressList .ui-content .ui-listview-inset,
		.ui-panel-inner>.ui-listview-inset {
			margin: 0;
			box-shadow: none;
		}
		
		#AddressList .ui-listview>li.ui-first-child,
		.ui-listview>li.ui-first-child>a.ui-btn {
			border-top: none;
		}
		
		#AddressList .ui-btn.ui-btn-icon-right.ui-icon-carat-r {
			background: #dadada;
			color: #353535;
			font-size: 14px;
			border-radius: 0px;
			font-family: "微软雅黑";
		}
		
		#AddressList .ui-radio {
			width: 25px;
			float: left;
		}
		
		#mypage #AddressList .ui-radio label.ui-btn {
			background: none;
			border: none;
			width: 25px;
			display: block;
			position: absolute;
			left: 5px;
			top: 50%;
			margin-top: -9px;
		}
		
		#AddressList .ui-radio {
			margin: 0;
			position: inherit;
		}
		
		.add_address .ui-btn-icon-notext.ui-btn-left {
			top: 2px;
		}
		
		.add_address .ui-icon-carat-d:after {
			background: url(images/bottom_icon.png) no-repeat right center;
			background-size: contain;
		}
		
		.add_address .ui-input-text {
			margin: 0;
			box-shadow: none;
			border: none;
		}
		
		.add_address .ui-select {
			margin: 0;
			box-shadow: none;
			width: 85%;
		}
		
		#AddressList .add_address .ui-checkbox .ui-btn {
			background: #fff;
			border: 1px solid #fff;
		}
		
		.add_address .ui-checkbox {
			margin: 0;
			float: right;
		}
		
		#mypage .add_address .ui-btn.ui-icon-carat-d.ui-btn-icon-right.ui-corner-all.ui-shadow {
			background: none;
			border-radius: 0;
			border: 1px solid #ddd;
			text-align: left;
			padding: 8px 5px;
			box-shadow: none;
			color: #353535;
			font-size: 14px;
			font-family: "微软雅黑";
			font-weight: normal;
		}
		
		.add_address .ui-input-text input,
		.ui-input-text {
			color: #353535;
			font-size: 14px;
			font-family: "微软雅黑";
			font-weight: normal;
		}
		
		#AddressDetail .btn1 {
			margin: 2em 1em;
		}
		
		#AddressDetail .btn1 a {
			display: block;
			padding: 0.5em 0;
			background: url(images/allbtn_bg.jpg) no-repeat center top;
			background-size: cover;
			color: #fff;
			text-align: center;
			font-family: "微软雅黑";
			font-size: 14px;
			font-weight: normal;
		}
		
		#AddressDetail .add_address .ui-btn-icon-notext.ui-btn-left {
			top: 2px;
		}
		
		#AddressDetail .add_address .ui-icon-carat-d:after {
			background: url(images/bottom_icon.png) no-repeat right center;
			background-size: contain;
		}
		
		#AddressDetail .add_address .ui-input-text {
			margin: 0;
			box-shadow: none;
			border: none;
		}
		
		#AddressDetail .add_address .ui-select {
			margin: 0;
			box-shadow: none;
			width: 100%;
		}
		
		#AddressDetail .add_address .ui-checkbox .ui-btn {
			background: #fff;
			border: 1px solid #fff;
			margin-top: 3px;
		}
		
		#AddressDetail .add_address .ui-checkbox {
			margin: 0;
			float: right;
		}
		
		#AddressDetail .add_address .ui-checkbox input {
			display: none;
		}
		
		#AddressDetail .add_address .ui-btn.ui-icon-carat-d.ui-btn-icon-right.ui-corner-all.ui-shadow {
			background: none;
			border-radius: 0;
			border: 1px solid #ddd;
			text-align: left;
			padding: 8px 5px;
			box-shadow: none;
			color: #353535;
			font-size: 14px;
			font-family: "微软雅黑";
			font-weight: normal;
		}
		
		#AddressDetail .add_address .ui-input-text input,
		#mypage .add_address .ui-input-text {
			color: #353535;
			font-size: 14px;
			font-family: "微软雅黑";
			font-weight: normal;
		}
		
		.add_address ul {
			overflow: auto;
			zoom: 1;
			background: #fff;
			border-bottom: 1px solid #ddd;
			padding: 8px 10px;
		}
		
		.add_address li:nth-child(2n+1) {
			float: left;
			width: 25%;
			text-align: right;
			color: #8e8e8e;
			font-weight: normal;
			font-size: 14px;
			font-family: "微软雅黑";
			line-height: 30px;
		}
		
		.add_address li:nth-child(2n+2) {
			float: right;
			width: 70%;
		}
		
		.add_address .btn {
			margin: 2em 1em;
		}
		
		#AddressDetail .msg-box {
			float: right;
			margin-top: -20px;
		}
		
		#AddressList .boxlist .ui-radio {
			position: absolute;
			top: 50%;
			margin: -9px;
		}
		
		#mypage .ui-input-text {
			box-shadow: none;
		}
		
		#sumit_order_btn {
			width: 68px;
		}
		
		#mypage .ui-footer {
			position: fixed;
		}
		
		.givePresent {
			background: #fff;
			min-height: 36px;
			font-size: 12px;
			border-bottom: 1px solid #eee;
			padding-left: 10px;
			line-height: 16px;
			display: none;
			align-items: center;
		}
		
		.givePresent .give {
			color: #fff;
			background: #1EA2FE;
			display: inline-block;
			width: 44px;
			height: 23px;
			font-size: 12px;
			border-radius: 5px;
			-moz-border-radius: 5px;
			-webkit-border-radius: 5px;
			text-align: center;
			line-height: 23px;
		}
		
		.order_ok .title {
			border-bottom: 1px dashed #eeeeee;
		}
		
		.givePresent .man {
			margin-left: 10px;
		}
		
		.productList .boxGroup {
			border-bottom: 5px solid #f9f9f9;
		}
		
		.productList .boxGroup:first-child {
			margin-top: 0;
		}
		
		.yhsx {
			background: #fff
		}
		
		.yhsx div {
			border-bottom: 1px solid #eee;
			line-height: 18px;
		}
		
		.order_ok .order_okbox .right .text {
			font-family: "微软雅黑";
			font-size: 14px;
			color: #000;
		}
		
		#discountFee>span {
			width: 100%;
			display: block;
		}
		
		#UserMember {
			background: #fff;
			margin-bottom: 10px;
		}
		
		#Integral {
			background: #fff;
			margin-top: 10px;
			padding: 0.2em 1em;
			border-bottom: 1px solid #eee;
			border-top: 1px solid #eee;
		}
		
		#Integral label {
			padding: 0;
			border: none;
			background: #fff;
			height: 30px;
			line-height: 30px;
			font-size: 14px;
			width: auto;
			display: inline-block;
		}
		
		.Cantclick {
			color: #ddd!important;
		}
		
		.Cantclick span {
			color: #ddd!important;
		}
		
		.ui-checkbox-off:after,
		.ui-btn.ui-radio-off:after {
			opacity: 1
		}
		
		.MomeyName {
			display: inline-block;
			float: left;
			padding-left: 10px;
		}
		
		#MyPayType {
			display: block;
			border: none;
			font-size: 14px;
			padding: 0;
			line-height: 5px;
			height: 20px;
		}
		
		#MyPayType a {
			font-weight: normal;
			color: #000!important;
		}
		
		#div_payment_type {
			background: #fff url(images/usercenter_righticon.png) no-repeat right center!important;
			background-size: 4% 61%!important;
			width: 97.5%;
			border: none;
		}
		
		.pay_type_p {
			width: 100%;
			text-align: center;
			background: #fff;
			padding: 10px 0;
			border-bottom: 1px solid #eee;
			color: #999;
		}
		
		#span_coupon {
			float: right;
		}
		
		#span_hongbao {
			float: right;
		}
		
		.submit_ok #div_payment_type {
			padding: 0.6em 1em!important;
			border-radius: 0;
			border: none;
		}
		
		#Memberlabel {
			color: #000;
			font-family: "微软雅黑";
			font-weight: normal;
			background: none;
			border: none;
			font-size: 14px;
			padding: 0;
			height: 30px;
			line-height: 30px;
			width: auto;
			display: inline-block;
		}
		
		#MemberRadios {
			margin: 0!important;
			padding: 5px 0 0.2em 15px;
		}
		
		#div_payment_type {
			border: none;
			margin: 0!important;
		}
		
		.div_payment_type {
			background: #fff;
			border-bottom: 1px solid #eee;
			border-top: 1px solid #eee;
		}
		
		#li_coupon a {
			border: none!important;
		}
		
		#li_coupon a {
			border: none!important;
		}
		
		.Paytable tbody tr td {
			padding: 0 5px;
			width: 100%;
			box-sizing: border-box;
		}
		
		.submit_ok>ul li:first-child {
			border-bottom: 1px dashed #eeeeee;
		}
		
		.order_ok {
			border: none!important;
		}
		
		.ui-listview>li p {
			font-size: 12px;
		}
		
		.order_ok .order_okbox .right span {
			padding: 0px;
			color: #8e8e8e;
		}
		
		.order_ok .order_okbox .right p {
			color: #8e8e8e;
		}
		
		.order_ok .title {
			padding: 5px 5px 5px 15px;
		}
		
		.order_ok td font {
			margin: 0 5px;
		}
		
		.integralmomey {
			color: red
		}
		
		.submit_ok #div_remark {
			margin: 10px 0;
		}
		
		.order_ok td i {
			margin-right: 0;
		}
		
		div[role="application"] {
			margin: 0;
			width: 55px;
			float: right;
			margin-right: 15px;
			height: 30px;
			border-radius: 15px!important;
		}
		
		a[aria-labelledby="Label1"] {
			width: 26px!important;
			height: 26px!important;
		}
		
		a[aria-labelledby="Memberlabel"] {
			width: 26px!important;
			height: 26px!important;
		}
		
		.ui-slider-switch .ui-btn.ui-slider-handle {
			margin: 1px 0 0 -10px;
		}
		
		#Integral .ui-radio {
			display: flex;
			justify-content: space-between;
			align-items: center;
		}
		
		.ui-shadow-inset {
			box-shadow: none;
			-webkit-box-shadow: none
		}
		
		.order_ok .title {
			font-size: 13px;
		}
		
		.order_okbox .fee {
			font-size: 13px;
		}
		
		.sealnumber {
			margin-left: 5px;
		}
		
		.submit_footer {
			padding: 0 1em;
		}
		
		.ui-body-a,
		.ui-page-theme-a .ui-body-inherit,
		html .ui-bar-a .ui-body-inherit,
		html .ui-body-a .ui-body-inherit,
		html body .ui-group-theme-a .ui-body-inherit,
		html .ui-panel-page-container-a {
			text-shadow: none!important;
		}
		
		.submit_footer .sureorder div {
			margin: 6px 0;
		}
		
		.submit_footer .ui-btn-i {
			width: 75px;
			padding: 0px 5px;
			text-align: center;
			border-radius: 3px !important;
			height: 35px;
			line-height: 35px;
			font-size: 14px;
		}
		
		#sumit_order_btn {
			width: 85px;
			border-radius: 3px;
			height: 40px;
		}
		
		#mypage .ui-footer {
			border-top: 1px solid #eee
		}
		
		.ui-mobile-viewport {
			-webkit-tap-highlight-color: none!important;
		}
		
		.ui-page-theme-a .ui-btn.ui-btn-active,
		html .ui-bar-a .ui-btn.ui-btn-active,
		html .ui-body-a .ui-btn.ui-btn-active,
		html body .ui-group-theme-a .ui-btn.ui-btn-active,
		html head+body .ui-btn.ui-btn-a.ui-btn-active,
		.ui-page-theme-a .ui-checkbox-on:after,
		html .ui-bar-a .ui-checkbox-on:after,
		html .ui-body-a .ui-checkbox-on:after,
		html body .ui-group-theme-a .ui-checkbox-on:after,
		.ui-btn.ui-checkbox-on.ui-btn-a:after,
		.ui-page-theme-a .ui-flipswitch-active,
		html .ui-bar-a .ui-flipswitch-active,
		html .ui-body-a .ui-flipswitch-active,
		html body .ui-group-theme-a .ui-flipswitch-active,
		html body .ui-flipswitch.ui-bar-a.ui-flipswitch-active,
		.ui-page-theme-a .ui-slider-track .ui-btn-active,
		html .ui-bar-a .ui-slider-track .ui-btn-active,
		html .ui-body-a .ui-slider-track .ui-btn-active,
		html body .ui-group-theme-a .ui-slider-track .ui-btn-active,
		html body div.ui-slider-track.ui-body-a .ui-btn-active {
			background-color: #f9384d
		}
	</style>
	<style type="text/css" media="screen">
		.couponbox {
			overflow: hidden;
			margin-bottom: 5px;
			padding: 0 10px;
			background: #fff;
			border-bottom: 1px solid #ddd;
			border-top: 1px solid #eee;
			position: relative;
		}
		
		.couponbox .left {
			width: 70px;
			top: 50%;
			;
			color: #fff;
			text-align: center;
			position: absolute;
			margin-top: -35px;
		}
		
		.couponbox .left div {
			width: 70px;
			height: 70px;
			background: url(images/yhq.png) no-repeat;
			background-size: cover;
			overflow: hidden;
		}
		
		.couponbox .left h5 {
			font-size: 12px;
			margin-top: 18px;
		}
		
		.couponbox .left h5 span {
			font-size: 16px;
		}
		
		.couponbox .left p {
			font-size: 12px;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
		}
		
		.couponbox .right {
			float: left;
			width: calc(100% - 80px);
			width: -webkit-calc(100% - 80px);
			width: -moz-calc( 100% - 80px);
			margin-left: 80px;
		}
		
		.couponbox .right .top {
			overflow: hidden;
			padding-bottom: 3px;
			line-height: 30px;
		}
		
		.couponbox .right .top p {
			float: left;
		}
		
		.couponbox .right .top span {
			float: right;
			color: #f9384d;
			font-size: 12px;
		}
		
		.couponbox .right .cent {
			overflow: hidden;
			border-top: 1px solid #eee;
			padding: 5px 0;
		}
		
		.couponbox .right .cent h4 {
			font-size: 14px;
		}
		
		.couponbox .right .cent p {
			font-size: 12px;
			color: #a8a8a8;
		}
		
		.couponbox .right .cent span {
			background: #ffae00;
			color: #fff;
			font-size: 12px;
			display: inline-block;
			padding: 0 3px;
			margin: 3px 0;
		}
		
		.couponbox .right .cent span.status {
			background: #66CC99;
		}
		
		#page_hongbao .couponbox .ui-checkbox {
			position: absolute;
			top: 50%;
			margin: -9px;
		}
	</style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
	<!--S page -->
	<div data-role="page" id="mypage">
		<!--S header -->
		<div data-role="header">
		</div>
		<!--E header -->
		<!--S content -->
		<div role="main" class="ui-content">
			<form id="form_submit_order" command="CreateOrder">
				<!--s submit_ok-->
				<div class="submit_ok">
					<ul data-role="listview" data-inset="true" style="border-radius: 0;">
						<li id="li_address">
							<a href="javascript:void(0)" onclick="selectAddress();" style="border:none!important;">收货地址<span id="finalAddr"></span></a>
						</li>

					</ul>
					<!--s order_ok-->
					<div class="order_ok">
						<div class="title">
							产品信息</div>
						<div class="productList">
						</div>

						<table width="100%" cellspacing="0" cellpadding="0" border="0" style="background: #fff" class="Paytable">
							<tbody>
								<tr>
									<td>
										<span><p class="MomeyName">商品总价</p><font><i>￥</i><span id="totalPrice">0</span></font>
										</span>
									</td>

								</tr>
								<tr>
									<td id="Integral_Momey" style="display:none">
										<span><p class="Integral_Momey">积分抵扣</p><font>-<i>￥</i><span class="integralmomey"></span></font>
										</span>
									</td>

								</tr>
								<tr style="display:none">
									<td id="discountFee">
										<span><font>-</font><p class="MomeyName">优惠</p><font><i>￥</i><span>0</span></font>
										</span>
									</td>
								</tr>
								<tr>
									<td id="span_ship_price" style="display:none">
										<span><font>+</font><p class="MomeyName">运费</p><font><i>￥</i><span id="shipPrice">0</span></font>
										</span>
									</td>
								</tr>
								<tr>
									<td id="span_score_amount" style="display:none">
										<span><font>-</font>积分抵扣<font><i>￥</i><span id="font_score">0</span></font>
										</span>
									</td>
								</tr>
								<tr>
									<td id="span_coupon_amount" style="display:none">
										<span><font></font><p class="MomeyName">优惠券</p><font>-<i>￥</i><span id="font_coupon">0</span></font>
										</span>
									</td>
								</tr>

							</tbody>
						</table>

					</div>
					<!--e order_ok-->

					<ul data-role="listview" data-inset="true" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
						<li id="li_coupon" style="display: block;border-radius: 0;">
							<a onclick="transferToPage('page_coupon')">优惠券<span id="span_coupon"><span class="position" style="margin-left: 5px;"></span>可用优惠券</span>
							</a>
						</li>
					</ul>
					<ul data-role="listview" data-inset="true" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
						<li id="li_hongbao" style="display: block;border-radius: 0; border-top: 1px dashed #eee;">
							<a style="border: none;" onclick="transferToPage('page_hongbao')">红包<span id="span_hongbao"><span class="position" style="margin-left: 5px;"></span>可用红包</span>
							</a>
						</li>
					</ul>
					<div id="UserMember" style="margin-bottom: 0;">
						<fieldset data-role="controlgroup" id="MemberRadios" data-iconpos="right" style="display:none;">
							<div class="ui-radio">
								<label for="User_Member" class="ui-btn ui-corner-all ui-btn-inherit ui-radio-off" id="Memberlabel"></label>
								<select id="User_Member" data-role="slider">
									<option value="false"></option>
									<option value="true"></option>
								</select>
							</div>
						</fieldset>
						<fieldset data-role="controlgroup" id="Integral" data-iconpos="right" style="margin:0;border:0;padding:5px 0 0.2em 15px;border-top: 1px dashed #eee;">
							<div class="ui-radio">
								<label for="slider" class="ui-btn ui-corner-all ui-btn-inherit ui-radio-off" id="Label1">可用<span class="integral"></span>积分抵扣<span class="integralmomey"></span>元</label>
								<select id="slider" data-role="slider" onchange="ChangeEvent();">
									<option value="false"></option>
									<option value="true"></option>
								</select>
							</div>
						</fieldset>
					</div>
					<p style="color: #c5c5c5;text-align: right;padding: 5px 15px 0;font-size: 10px;margin-bottom: 10px;">*优惠劵、积分、折扣不能同时使用</p>
					<div class="div_payment_type">
						<ul data-role="listview" data-inset="true" class="ui-listview ui-listview-inset ui-corner-all ui-shadow" id="div_payment_type">
							<li id="MyPayType" style="display: block;" onclick="transferToPage('Pay_Type')">
								<fieldset data-role="controlgroup" id="choosepaymenttype">
									<a style="color: #a4a4a4;font-weight: normal;">
										<span id="pay_types">支付方式</span>
										<span id="my_paytypes" style="float: right;color: #8e8e8e;margin-right:10px;"></span>
									</a>
								</fieldset>
							</li>
							<div id="nopaymenttype" style="display:none">本订单不需要支付费用</div>
						</ul>
					</div>
					<!--s zhifu-->
					<div id="div_remark">
						<fieldset data-role="controlgroup">
							<legend>留言：</legend>
							<textarea cols="40" rows="8" command-param='Remark' name="txt_remark" id="txt_remark" placeholder="请留言"></textarea>
						</fieldset>
					</div>

					<input type="hidden" id="hid_address" />
					<input type="hidden" id="hid_coupon_code" value="-1" />
					<input type="hidden" id="hid_member_account" command-param='MemberAccount' value='<%=CurrentMemberAccount %>' value='shop' />
					<input type="hidden" id="hid_kind" command-param='Kind' value='shop' />

				</div>
				<!--e submit_ok-->
				<div style="padding: 0px 1em 0.5em; color:#f9384d;" class="loaderTipsHandler"><span prop="Module.Content"></span></div>
				<div style="padding: 0px 1em 0.5em; color:#f9384d;" class="loaderTipsHandler2"></div>
			</form>
		</div>
		<!--E content -->
		<!--S footer -->
		<div data-role="footer" data-position="fixed" data-tap-toggle="false">
			<div class="submit_footer">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr style="width:100%">
						<td style="float:left; margin-top:13px;">实付金额:<i>￥</i><span id="span_realpay_price" scorecut='0' couponcut='0' integralmomey='0'>0</span></td>
						<td style="float:right" class="sureorder">
							<input type="button" value="确认下单" disabled="1" data-theme="i" data-shadow="false" id="sumit_order_btn" onclick="submitOrder(this);" style="width: 68px; border-radius:3px" />
							<%--<a href="javascript:void(0);" data-role="button" data-theme="i" data-shadow="false" id="sumit_order_btn" onclick="submitOrder(this);">确认下单</a>--%>
						</td>
					</tr>
				</table>

			</div>
		</div>
		<!--E footer -->

	</div>
	<!--E page -->
	<!--E AddressList -->
	<div data-role="page" id="AddressList">
		<div role="main" class="ui-content">
			<div style="font-size: 14px; background-color: #fff; padding: 0.5em; color: #666">
				请选择收货地址：</div>
			<div data-role="listview" data-inset="true" id="div_address_list" class="address" style="display: none">
			</div>
			<ul data-role="listview" data-inset="true" class="addsite" style="margin-top: 1em;">
				<li>
					<a href="#" onclick="newAddress()" style="font-size: 14px;">新增收货地址</a>
				</li>
			</ul>
		</div>
	</div>
	<!--E AddressList -->
	<!--S page -->
	<div data-role="page" id="AddressDetail">
		<!--S header -->
		<div data-role="header">
		</div>
		<!--E header -->
		<!--S content -->
		<div role="main" class="ui-content">
			<!--s add_address-->
			<div class="add_address">
				<form id="form_save_addr" command='Member.SaveAddress'>
					<input command-param='AddressId' type="hidden" value='0' />
					<input command-param='MemberAccount' type="hidden" value='<%=CurrentMemberAccount %>' />
					<ul>
						<li>收货人</li>
						<li>
							<input type="text" command-param='Receiver' placeholder="收货人" data-rule="required;accept" name="Receiver" prop="Data.Receiver">
						</li>
					</ul>
					<ul>
						<li>手机号码</li>
						<li>
							<input type="text" placeholder="请输入联系电话" command-param='Phone' name="Phone" prop="Data.Phone" data-rule="required;mobile">
						</li>
					</ul>
					<ul>
						<li>省份</li>
						<li>
							<select name="Province" command-param='Province' class="area" data-theme="e" category="Province" referencecategory="City" data-rule="selectval">
								<option value="-1">请选择</option>
							</select>
						</li>
					</ul>
					<ul>
						<li>市</li>
						<li>
							<select name="City" data-theme="e" command-param='City' class="area" category="City" referencecategory="Area" data-rule="selectval">
								<option value="-1">请选择</option>
							</select>
						</li>
					</ul>
					<ul>
						<li>区/县</li>
						<li>
							<select name="Area" data-theme="e" command-param='Area' class="area" category="Area">
								<option value="-1">请选择</option>
							</select>
						</li>
					</ul>
					<%-- --%>
					<ul>
						<li>详细地址</li>
						<li>
							<textarea cols="40" rows="8" command-param='Address' name="Address" data-rule="required" placeholder="请输入详细的地址" prop="Data.Address"></textarea>
						</li>
					</ul>
					<ul>
						<li>
							<label>
                            <input type="checkbox" name="ckmr" onchange="$('#addr_status').val((($(this).prop('checked')==true)?'1':'0'))">
                            <input prop="Data.Status" type="hidden" id="addr_status" command-param='Status'>
                        </label>
						</li>
						<li>
							<label for="ckmr">
                            设为默认地址</label></li>
					</ul>

				</form>
				<div class="" style="margin: 1em;">
					<a href="#" id="SaveAdd" data-role="button" onclick="return executeFormCommonCommand('form_save_addr', SaveAddressDone)">
						确认</a>
				</div>
			</div>
			<!--e add_address-->
		</div>
		<!--E content -->
		<!--S footer -->
		<div data-role="footer" data-position="fixed" data-tap-toggle="false">
		</div>
		<!--E footer -->
	</div>
	<!--E page_coupon -->
	<div data-role="page" id="page_coupon">
		<div role="main" class="ui-content">
			<div class="address">
				<div class="couponList">
				</div>
				<div class="boxlist" style="text-align: center; color: #999;" onclick="selectCoupon(this)" type='-1' couponname='不使用优惠券' couponcode='-1'>
					不使用优惠券
				</div>
			</div>
		</div>
	</div>
	<!--E page_coupon -->

	<!--E page_coupon -->
	<div data-role="page" id="page_hongbao">
		<div role="main" class="ui-content">
			<div class="address">
				<div class="hongbaoList">
				</div>
				<div class="boxlist" style="text-align: center;" onclick="selectHongbaoConfirm()">
					确定
				</div>
			</div>
		</div>
	</div>
	<!--E page_coupon -->

	<!--E page_Pay_Type -->
	<div data-role="page" id="Pay_Type">
		<div role="main" class="ui-content">
			<div class="address">
				<div class="payment">
				</div>
			</div>
		</div>
	</div>
	<!--E page_Pay_Type -->

	<script>
		var _hmt = _hmt || [];
	</script>
	<script src="/Wap/lib/validator-0.7.0/jquery.validator.js?v=1" type="text/javascript"></script>
	<script src="/Wap/lib/validator-0.7.0/local/zh_CN.js" type="text/javascript"></script>
	<link href="/Wap/lib/validator-0.7.0/css/jquery.validator.css" rel="stylesheet" type="text/css" />
	<script src="/wap/lib/common/listviewHandler.js" type="text/javascript"></script>
	<script src="/wap/lib/common/loaderHandler.js" type="text/javascript"></script>
	<script src="/wap/lib/common/addressCascade.js" type="text/javascript"></script>
	<script>
		var validScoreDataResult = <%=ValidScoreData %>;

		var validScoreData = {
			//可用多少分
			TotalScore: 0,

			//兑换配置每多少分兑换多少元
			ExchangeConfig: {
				Score: 1,
				Fee: 0.01
			}
		};
		if(validScoreDataResult.ErrorCode == 0) {
			validScoreData = validScoreDataResult.Data;
		}
	</script>
	<script type="text/javascript">
		//判断数据加载状态，限制加载完之后才能切换page/提交订单
		var loaderStat = {};

		//是否需显示地址输入，如果存在非虚拟产品，则显示地址
		var isShowAddr = false;

		//检查数据加载情况
		function checkLoaderStat() {
			for(var prop in loaderStat) {
				if(loaderStat[prop] == false) {
					return false;
				}
			}
			return true;
		}
		var _couponStatu = false;

		//设置提交按钮的状态
		function setSubmitBtnStat() {
			if(checkLoaderStat()) {
				$('#sumit_order_btn').button("enable");
			}
		}

		//数据初始化
		var orderProductList = []; //结算产品
		$(function() {
			loaderStat.LoadSelectedProduct = false;
			LoadSelectedProduct();

			loaderStat.LoadPaymentList = false;
			LoadPaymentList();

			//loaderStat.LoadCouponTicketList = false;
			//LoadCouponTicketList();

			loaderStat.LoadDefaultAddress = false;
			LoadDefaultAddress();

			loadPayTips();
		});

		function LoadDefaultAddress() {
			var handler = $('#finalAddr').loaderHandler();
			handler.initialize({
				command: 'Member.LoadDefaultAddress',
				parameter: {
					MemberAccount: '<%=CurrentMemberAccount %>'
				},
				afterHandleResult: function(result, totalCount, container) {
					if(result.Data) {
						var addtStr = "{Receiver}，{Phone}<p>{ProvinceName}{CityName}{AreaName}{Address}</p>";
						$('#finalAddr').html(addtStr.format(result.Data));
						$("#hid_address").val(result.Data.Id);
					}
					//加载完毕
					loaderStat.LoadDefaultAddress = true;
					setSubmitBtnStat();
				}
			});
			handler.load();
		}
		var _coupons;

		function LoadCouponTicketList(orderproduct) {
			//command: 'Member.LoadSelectedProducts', $('.productList').loaderHandler();
			var handler = $('.couponList').listviewHandler();

			var params = [];
			for(var i = 0; i < orderproduct.length; i++) {
				params.push({
					ProductNo: orderproduct[i].ProductNo,
					SalePrice: orderproduct[i].SalePrice,
					Counter: orderproduct[i].Counter,
					ProductSkuNo: orderproduct[i].ProductSkuNo,
					DeptCode: orderproduct[i].DeptCode,
					TypePrefix: orderproduct[i].TypePrefix,
				});
			}

			handler.initialize({
				loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
				emptyHtml: '无记录', //无记录时显示此html
				itemTemplate: ' <div class="couponbox" onclick="selectCoupon(this)" type="{Type}" couponname="{Title}" couponcode="{TicketCode}">' +
					' <div class="left">' +
					'        <div>' +
					'            <h5>¥<span>{Amount}</span></h5>' +
					'            {desc}' +
					'        </div>' +
					'    </div>' +
					'    <div class="right">' +
					'        <div class="top">' +
					'            <p>{Title}</p>' +
					'        </div>' +
					'        <div class="cent">' +
					'            <span>{Memo}</span>{Status}' +
					'            <p>有效期：{StartTime} 至 {EndTime}</p>' +
					'        </div>' +
					'    </div>' +
					' </div>',
				pageIndex: 1, //页码（从1起算）
				pageSize: 100, //页大小
				totalCount: 999, //总记录数
				itemHandler: function(data, itemTemplate, container) { //数据各项处理
					//背景颜色
					var bg = 'style="background:#a8a8a8;"';
					if(data.Status == "1") {
						var EndTime = new Date(Date.parse(data.EndTime.replace(/-/g, "/")));
						var date = new Date(Date.parse(data.StartTime.replace(/-/g, "/")));
						if(date.getTime() < new Date().getTime() && new Date().getTime() < EndTime.getTime()) {
							data.Status = ' <span class="status">可用</span>';
						} else {
							if(date.getTime() > new Date().getTime()) {
								data.Status = ' <span class="status" ' + bg + '>未生效</span>';
							}
							if(EndTime.getTime() < new Date().getTime()) {
								data.Status = ' <span class="status " ' + bg + '>已过期</span>';
							}
						}
					}
					if(data.Status == "9") {
						data.Status = ' <span class="status "' + bg + '>已使用</span>';
					}
					//data.ThumbnailImg = firstThumbnail(data.ThumbnailImg);
					//格式开始时间
					data.StartTime = getShortDateString(data.StartTime);
					//格式结束时间

					if(data.OrderMinAmount) {
						data.desc = '<p>满{OrderMinAmount}减{Amount}</p>'.format(data);
					} else {
						data.desc = '<p></p>';
					}

					data.EndTime = getShortDateString(data.EndTime);

					return itemTemplate.format(data);
				},
				afterHandleResult: function(result, totalCount, container) {
					if(totalCount > 0) {
						$('#li_coupon .position').html(totalCount + '张');
						$(".couponList").show();
						$(".couponList").trigger("create");
						_coupons = $('#li_coupon .position').html() + '可用优惠券';
					} else {
						$('#li_coupon .position').html('无');
						$(".couponList").hide();
					}

					//加载完毕
					loaderStat.LoadCouponTicketList = true;
					setSubmitBtnStat();
				},
				command: 'Member.LoadCouponTicketList',
				parameter: {
					MemberAccount: '<%=CurrentMemberAccount %>',
					ProductList: params,
					type: 4
				}
			});
			handler.nextPage();
		}

		// 选择红包红包
		function selectHongbao(el) {
			var $this = $(el);
			if($this.is('input[type="checkbox"]')) {
				var $checkbox = $this;
			} else {
				var $checkbox = $this.find('input[type="checkbox"]');
				$checkbox.prop('checked', !$checkbox.prop('checked')).checkboxradio("refresh");
			}
			var select = $('#page_hongbao').find('input[type="checkbox"]:checked').parents('.couponbox').map(function(index, el) {
				return $(el).attr('couponcode');
			}).get();
			if(select.length <= 3) {
				$('#page_hongbao').data('value', select);
			} else {
				$checkbox.prop('checked', !$checkbox.prop('checked')).checkboxradio("refresh");
				showTips("只能选择3个红包哦！");
			}
		};

		function selectHongbaoConfirm() {

			var value = $('#page_hongbao').data('value');
			jQuery.mobile.changePage($('#mypage'));
			if(value && value.length) {

				$("#span_coupon_amount").fadeIn();
				$("#slider").slider("disable");
				$('#span_realpay_price').attr('integralmomey', 0);
				$('#Integral label,.integralmomey').css({
					'color': '#d7d7d7'
				});
				$('#Memberlabel').css({
					'text-decoration': 'line-through',
					'color': '#d7d7d7'
				});
				$("#User_Member").slider("disable");
				$('#Label1').css({
					'text-decoration': 'line-through'
				});
				calCoupon = true;

				$('#li_coupon').children('a').removeAttr('onclick').addClass('Cantclick').css({
					'text-decoration': 'line-through'
				});
				$('#span_coupon').css({
					'text-decoration': 'line-through'
				});
				$('#span_hongbao').text('使用' + value.length + '个红包');
				valuation();

			} else {
				if(!value) {
					$('#page_hongbao').data('value', []);
				}
				realPayPriceSpan.attr("couponcut", '0');
				$("#span_coupon_amount").fadeOut();
				$("#font_coupon").html("0");
				calTotalPrice();

				$("#slider").slider("enable").slider("refresh");
				$('#slider').attr("disabled", false);
				$('#Label1').css({
					'text-decoration': 'none',
					'color': '#333'
				});
				$('.integralmomey').css({
					'color': "red"
				})

				$('#Memberlabel').css({
					'text-decoration': 'none',
					'color': '#000'
				});
				$("#User_Member").slider("enable").slider("refresh");
				$('#User_Member').attr("disabled", false);

				$('#li_coupon').children('a').attr('onclick', 'transferToPage(\'page_coupon\')').removeClass('Cantclick').css({
					'text-decoration': 'none'
				});
				$('#span_coupon').css({
					'text-decoration': 'none'
				});
				$('#span_hongbao').text('不使用红包');
			}
		};

		function LoadHongbaoTicketList(orderproduct) {
			//command: 'Member.LoadSelectedProducts', $('.productList').loaderHandler();
			var handler = $('.hongbaoList').listviewHandler();

			var params = [];
			for(var i = 0; i < orderproduct.length; i++) {
				params.push({
					ProductNo: orderproduct[i].ProductNo,
					SalePrice: orderproduct[i].SalePrice,
					Counter: orderproduct[i].Counter,
					ProductSkuNo: orderproduct[i].ProductSkuNo,
					DeptCode: orderproduct[i].DeptCode,
					TypePrefix: orderproduct[i].TypePrefix,
				});
			}

			handler.initialize({
				loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
				emptyHtml: '无记录', //无记录时显示此html
				itemTemplate: '' +
					'<div class="couponbox" onclick="selectHongbao(this)" type="{Type}" couponname="{Title}" couponcode="{TicketCode}">' +
					'    <label for="rdo_select_hongbao"><input name="rdo_select_hongbao_{TicketCode}" type="checkbox" onchange="selectHongbao(this)" ></label>' +
					'    <div class="left" style="left: 40px">' +
					'       <div>' +
					'           <h5>¥<span>{Amount}</span></h5>' +
					'           {desc}' +
					'       </div>' +
					'   </div>' +
					'   <div class="right" style="margin-left: 120px">' +
					'       <div class="top">' +
					'           <p>{Title}</p>' +
					'       </div>' +
					'       <div class="cent">' +
					'           <span>{Memo}</span>{Status}' +
					'           <p>有效期：{StartTime} 至 {EndTime}</p>' +
					'       </div>' +
					'   </div>' +
					'</div>',
				pageIndex: 1, //页码（从1起算）
				pageSize: 100, //页大小
				totalCount: 999, //总记录数
				itemHandler: function(data, itemTemplate, container) { //数据各项处理
					//背景颜色
					var bg = 'style="background:#a8a8a8;"';
					if(data.Status == "1") {
						var EndTime = new Date(Date.parse(data.EndTime.replace(/-/g, "/")));
						var date = new Date(Date.parse(data.StartTime.replace(/-/g, "/")));
						if(date.getTime() < new Date().getTime() && new Date().getTime() < EndTime.getTime()) {
							data.Status = ' <span class="status">可用</span>';
						} else {
							if(date.getTime() > new Date().getTime()) {
								data.Status = ' <span class="status" ' + bg + '>未生效</span>';
							}
							if(EndTime.getTime() < new Date().getTime()) {
								data.Status = ' <span class="status " ' + bg + '>已过期</span>';
							}
						}
					}
					if(data.OrderMinAmount) {
						data.desc = '<p>满{OrderMinAmount}减{Amount}</p>'.format(data);
					} else {
						data.desc = '<p></p>';
					}
					if(data.Status == "9") {
						data.Status = ' <span class="status "' + bg + '>已使用</span>';
					}
					//data.ThumbnailImg = firstThumbnail(data.ThumbnailImg);
					//格式开始时间
					data.StartTime = getShortDateString(data.StartTime);
					//格式结束时间
					data.EndTime = getShortDateString(data.EndTime);

					return itemTemplate.format(data);
				},
				afterHandleResult: function(result, totalCount, container) {
					if(totalCount > 0) {
						$('#li_hongbao .position').html(totalCount + '张');
						$(".hongbaoList").show();
						$(".hongbaoList").trigger("create");
						_coupons = $('#li_hongbao .position').html() + '可用红包';
					} else {
						$('#li_hongbao .position').html('无');
						$(".hongbaoList").hide();
					}

					//加载完毕
					loaderStat.LoadHongbaoTicketList = true;
					setSubmitBtnStat();
				},
				command: 'Member.LoadCouponTicketList',
				parameter: {
					MemberAccount: '<%=CurrentMemberAccount %>',
					ProductList: params,
					type: 5
				}
			});
			handler.nextPage();
		}

		function LoadPaymentList() {
			//command: 'Member.LoadSelectedProducts', $('.productList').loaderHandler();
			var handler = $('.payment').listviewHandler();
			handler.initialize({
				loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
				emptyHtml: '&nbsp;', //无记录时显示此html
				itemTemplate: '<p class="pay_type_p" name="rdo_payment" id="{Id}" interface="{InterfaceId}" PaymentName="{PaymentName}"  onclick="selectPayType(this)" isSelected="0">{PaymentName}</p>', //项模板
				pageIndex: 1, //页码（从1起算）
				pageSize: 100, //页大小
				totalCount: 999, //总记录数
				itemHandler: function(data, itemTemplate, container) { //数据各项处理
					return itemTemplate.format(data);
				},
				afterHandleResult: function(result, totalCount, container) {
					// $("input[type=radio]").checkboxradio("refresh");
					$(".payment").trigger("create");
					//加载完毕
					loaderStat.LoadPaymentList = true;
					//alert($('.payment .ui-radio').eq(0).html())
					//$('.payment .ui-radio').eq(0).children('label').removeClass('ui-radio-off').addClass('ui-radio-on');
					$('p[name=rdo_payment]:eq(0)').attr("isSelected", "1");
					$('#my_paytypes').html($('p[name=rdo_payment]:eq(0)').attr("paymentname"));
					setSubmitBtnStat();
				},
				command: 'Pub.LoadPaymentList',
				parameter: {
					Kind: 'WX'
				}
			});
			handler.nextPage();
		}

		function LoadSelectedProduct() {
			//command: 'Member.LoadSelectedProducts', $('.productList').loaderHandler();

			var gListTempLate = ' <div class="clear"></div>' +
				'<div class="givePresent "{disp}>' +
				' <span class="give ">优惠</span>' +
				'<span class="man">{satisfy}</span>' +
				'</div>';

			var pListTemplate = '<div class="order_okbox" data-sku="{ProductSkuNo}">' +
				' <div class="left"  onclick="location.href=\'ProductDetail.aspx?no={ProductNo}\'"><img src="{ThumbnailImg}"></div>' +
				' <div class="right">' +
				'     <div class="text">{ProductName}</div>' +
				'     <p>{SkuHtml}</p>' +
				'     <p class="fee">单价:<span style="font-size:10px;padding:0;margin:2px;">￥</span>{SalePrice}<span class="sealnumber">数量:{Counter}件</span></p>' +
				'     <p>{Remark}</p>' +
				' </div>' +
				'<div class="clear"></div>' +
				'</div>'

			var opHtml = '<div class="boxGroup" data-pk="{PkType}" data-type="{Type}" >' +
				'{ProductHtml}' +
				'<div class="clear"></div>' +
				'<div class="givePresent "{disp}>' +
				' <span class="give " {Style} type={Type}>{feetype}</span>' +
				'<span class="man">{satisfy}</span>' +
				'</div>' +
				'</div>'
			var handler = $('.productList').listviewHandler();
			handler.initialize({
				loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
				emptyHtml: '无记录', //无记录时显示此html
				itemTemplate: '<div class="boxGroup" data-pk="{PkType}" data-type="Type" >' +
					'{ProductHtml}' +
					'<div class="clear"></div>' +
					'<div class="givePresent "{disp}>' +
					' <span class="give ">{FeeType}</span>' +
					'<span class="man">{satisfy}</span>' +
					'</div>' +
					'</div>', //项模板
				pageIndex: 1, //页码（从1起算）
				pageSize: 100, //页大小
				totalCount: 999, //总记录数
				itemHandler: function(data, itemTemplate, container) { //数据各项处理
				},
				beforeHandleResult: function(result, totalCount, container) {

				},
				afterHandleResult: function(result, totalCount, container) {
					if(result.DiscountResult.MemberDiscountResult === null) {
						$('.submit_ok>ul li:first-child').css('border-bottom', 'none');
					} else {
						$('#Memberlabel').text(result.DiscountResult.MemberDiscountResult.Memo);
						$('#MemberRadios').show();
						$('#User_Member').change(function() {
							var Cacheval = $("#User_Member").val();
							if(Cacheval == 'true') {
								$('#li_coupon').children('a').removeAttr('onclick').addClass('Cantclick').css({
									'text-decoration': 'line-through'
								});
								$('#span_coupon').css({
									'text-decoration': 'line-through'
								});
								$('#Label1').css({
									'text-decoration': 'line-through'
								});
								$('#Integral_Momey').hide();
								$('#Integral label,.integralmomey').css({
									'color': '#d7d7d7'
								});
								$("#slider").slider("disable");
								ChangeEvent();
								$('#span_realpay_price').attr('couponcut', 0);
								$('#MemberRadios .ui-slider-handle').css({
									'margin-left': '-12px'
								});
								$('#span_coupon_amount').css({
									'display': 'none'
								});
								if(_couponStatu) {
									selectCoupon('.boxlist', Cacheval);
								};
								$('#span_coupon').html(_coupons)
								if(result.DiscountResult.MemberDiscountResult.DiscountFee > 0) {
									if(allshoppingFee > 0) {
										$('#discountFee').html('<span><font></font><p class="MomeyName">邮费</p><font>+<i>￥</i><span>' + Math.abs(allshoppingFee) + '</span></font></span><span><font></font><p class="MomeyName">会员优惠</p><font>-<i>￥</i><span>' + result.DiscountResult.MemberDiscountResult.DiscountFee + '</span></font></span>').parent().show();
									} else {
										$('#discountFee').html('<span><font></font><p class="MomeyName">会员优惠</p><font>-<i>￥</i><span>' + result.DiscountResult.MemberDiscountResult.DiscountFee + '</span></font></span>').parent().show();
									}
								} else {
									if(allshoppingFee > 0) {
										$('#discountFee').html('<span><font></font><p class="MomeyName">邮费</p><font>+<i>￥</i><span>' + Math.abs(allshoppingFee) + '</span></font></span>').parent().show();
									} else {
										$('#discountFee').html('').parent().show();
									}
								};
								$('.givePresent .give').each(function() {
									var typefees = $(this).attr('type');
									if(typefees != '1') {
										$(this).parent().css({
											'text-decoration': 'line-through',
											'color': '#8b8b8b'
										}).children('.give').css({
											'background': '#666'
										});
									}
								})
								var Memberpay = (result.TotalPrice).toFixed(2);
								var allMemberpay = Memberpay - result.DiscountResult.MemberDiscountResult.DiscountFee + allshoppingFee;
								var allpayFee = allMemberpay.toFixed(2);
								$('#totalPrice').text(Memberpay);
								$('#span_realpay_price').text(allpayFee);
								$('#span_realpay_price').attr("totalprice", allpayFee);
								$('#li_hongbao').children('a').removeAttr('onclick').addClass('Cantclick').css({
									'text-decoration': 'line-through'
								});
								$('#span_hongbao').css({
									'text-decoration': 'line-through'
								});
							} else {
								$('#li_coupon').children('a').attr('onclick', 'transferToPage(\'page_coupon\')').removeClass('Cantclick').css({
									'text-decoration': 'none'
								});
								$('#span_coupon').css({
									'text-decoration': 'none'
								});
								$('#Label1').css({
									'text-decoration': 'none',
									'color': '#333'
								});
								$('.integralmomey').css({
									'color': 'red'
								});
								$("#slider").slider("enable").slider("refresh");
								$('#MemberRadios .ui-slider-handle').css({
									'margin-left': '-16px'
								});
								ChangeEvent();
								$('.givePresent').css({
									'text-decoration': 'none',
									'color': '#333'
								}).children('.give').css({
									'background': '#1EA2FE'
								});
								var Memberpay = (result.TotalPrice).toFixed(2);
								var allMemberpay = Memberpay - allDiscountFee + allshoppingFee;
								var allpayFee = allMemberpay.toFixed(2);
								if(allDiscountFee > 0) {
									if(allshoppingFee > 0) {
										$('#discountFee').html('<span><font></font><p class="MomeyName">邮费</p><font>+<i>￥</i><span>' + Math.abs(allshoppingFee) + '</span></font></span><span><font></font><p class="MomeyName">促销优惠</p><font>-<i>￥</i><span>' + Math.abs(allDiscountFee) + '</span></font></span>').parent().show();
									} else {
										$('#discountFee').html('<span><font></font><p class="MomeyName">促销优惠</p><font>-<i>￥</i><span>' + Math.abs(allDiscountFee) + '</span></font></span>').parent().show();
									}
								} else {
									if(allshoppingFee > 0) {
										$('#discountFee').html('<span><font></font><p class="MomeyName">邮费</p><font>+<i>￥</i><span>' + Math.abs(allshoppingFee) + '</span></font></span>').parent().show();
									} else {
										$('#discountFee').html('');
									}
								}
								$('#totalPrice').text(Memberpay);
								$('#span_realpay_price').text(allpayFee);
								$('#span_realpay_price').attr("totalprice", allpayFee);
								$('#li_hongbao').children('a').attr('onclick', 'transferToPage(\'page_hongbao\')').removeClass('Cantclick').css({
									'text-decoration': 'none'
								});
								$('#span_hongbao').css({
									'text-decoration': 'none'
								});
							};
						})
					};
					var allDiscountFee = 0;
					var allshoppingFee = 0;
					if(totalCount == 0) {
						showTips("没有商品数据！请重新选购", 500, function() {
							location.href = "/Wap/ShoppingCart/";
						});
						return;
					}
					//获取运费

					//                     $(result.List).each(function () {
					//                     
					//                       $(this.ProductList).each(function () {
					////                          this.SalePrice = this.UnitPrice;
					////                           this.Counter = this.ProductCount;
					//                        orderProductList.push(this);
					//                    });

					//                     });
					var PromotionHash = {};
					$(result.DiscountResult.PromotionList).each(function() {
						if(!PromotionHash[this.RelationCode]) {
							PromotionHash[this.RelationCode] = [];
						}
						if(PromotionHash[this.RelationCode]) {
							var tempR = {};
							tempR = this;
							if(this.RelationCode != 0) {
								if((PromotionHash[this.RelationCode][0] && PromotionHash[this.RelationCode][0].Status != 1) || !PromotionHash[this.RelationCode][0]) {
									PromotionHash[this.RelationCode][0] = tempR;
								} else if(this.Status == 1) {
									PromotionHash[this.RelationCode][0] = tempR;
								}
							} else {
								if(this.Status == 1) {
									PromotionHash[this.RelationCode].unshift(tempR);
								} else {
									PromotionHash[this.RelationCode].push(tempR);
								}
							}
						};
					})
					var htmlObj = "";
					var sortProp = [];
					for(var prop in PromotionHash) {
						sortProp.push(prop);
					}
					sortProp = sortProp.sort();
					sortProp = sortProp.reverse();
					$(sortProp).each(function() {
						var prop = this;
						$(PromotionHash[prop]).each(function() {
							var listobj = this;
							listobj.ProductHtml = "";
							$(listobj.ProductList).each(function() {
								orderProductList.push(this);
								this.ThumbnailImg = firstThumbnail(this.ThumbnailImg);
								if(this.SkuParamCode) {
									this.SkuHtml = GetSkuItemHtml(this.SkuParamCode);
								}
								if(this.Remark) {
									this.Remark = '备注：' + this.Remark;
								}
								if(this.Kind == 'shop') {
									isShowAddr = true;
								}
								$("#hid_kind").val(this.Kind); //如果订单中有多种类型，则不能支
								listobj.ProductHtml += pListTemplate.format(this);
							});
							listobj.disp = "";
							listobj.feetype = "";
							listobj.satisfy = "";
							listobj.Style = "";
							if(listobj.Status == 1) {
								listobj.disp = "style='display:flex'";
								if(listobj.GiftList && listobj.GiftList != '[]') {
									$(listobj.GiftList).each(function() {
										listobj.satisfy += this.ProductName + "&nbsp;&nbsp;";;
									});
								}

								if(listobj.Type === 1 && listobj.ShippingFee >= 0 && listobj.DiscountFee == 0) {
									listobj.feetype += '邮费';
									listobj.satisfy += listobj.RuleTitle;
									allshoppingFee += listobj.ShippingFee;
								}
								if(listobj.Type === 0 && listobj.DiscountFee >= 0 && listobj.ShippingFee == 0) {
									listobj.feetype += '优惠';
									listobj.satisfy = listobj.Memo;
									allDiscountFee += listobj.DiscountFee;
								}
								if(listobj.Type === 3) {
									listobj.disp = "style='display:none'";
									listobj.feetype += '限制';
									listobj.satisfy = listobj.Memo;
									allDiscountFee += listobj.DiscountFee;
								}
							}
							if(allshoppingFee > 0 && allDiscountFee == 0) {
								$('#discountFee').html('<span><font></font><p class="MomeyName">邮费</p><font>+<i>￥</i><span>' + Math.abs(allshoppingFee) + '</span></font></span>').parent().show();
							}
							if(allshoppingFee > 0 && allDiscountFee > 0) {
								$('#discountFee').html('<span><font></font><p class="MomeyName">邮费</p><font>+<i>￥</i><span>' + Math.abs(allshoppingFee) + '</span></font></span><span><font></font><p class="MomeyName">促销优惠</p><font>-<i>￥</i><span>' + Math.abs(allDiscountFee) + '</span></font></span>').parent().show();
							}
							if(allshoppingFee == 0 && allDiscountFee > 0) {
								$('#discountFee').html('<span><font></font><p class="MomeyName">促销优惠</p><font>-<i>￥</i><span>' + Math.abs(allDiscountFee) + '</span></font></span>').parent().show();
							}

							var PkType = "";
							if(listobj.RelationCode != 0) {
								PkType = listobj.DeptCode + listobj.RelationCode;
								listobj.PkType = PkType;
							} else {
								PkType = listobj.DeptCode + listobj.RuleId;
								listobj.PkType = PkType;
							}

							htmlObj += opHtml.format(listobj);
						});
					});

					var $el = $('<div></div>').append(htmlObj);

					(function() {
						var postage_tmp = {};
						var promotionList = result.DiscountResult.PromotionList;
						$.each(promotionList, function(index, rule) {
							if(rule.Type === 1) {
								var pkType = '';
								if(rule.RelationCode != 0) {
									pkType = rule.DeptCode + rule.RelationCode;
								} else {
									pkType = rule.DeptCode + rule.RuleId;
								}
								rule.pkType = pkType;

								$.each(rule.ProductList, function(index, product) {
									var is = promotionList.some(function(rule) {
										return rule.Type !== 1 && rule.Type !== null && rule.ProductList.some(function(item) {
											return item.ProductNo === product.ProductNo;
										});
									});
									if(is) {
										var elstring = '[data-pk="' + pkType + '"][data-type="1"]';
										$el.find(elstring).find('.order_okbox[data-sku="' + product.ProductSkuNo + '"]').remove();
										postage_tmp[product.ProductNo] = elstring;
									}
								});
							}
						});
						$.each(promotionList, function(index, rule) {
							if(rule.Type === 3) {
								var pkType = '';
								if(rule.RelationCode != 0) {
									pkType = rule.DeptCode + rule.RelationCode;
								} else {
									pkType = rule.DeptCode + rule.RuleId;
								}
								rule.pkType = pkType;

								$.each(rule.ProductList, function(index, product) {
									var is = promotionList.some(function(rule) {
										return rule.Type !== 3 && rule.Type !== null && rule.ProductList.some(function(item) {
											return item.ProductNo === product.ProductNo;
										});
									});
									if(is) {
										var elstring = '[data-pk="' + pkType + '"][data-type="3"]';
										$el.find(elstring).find('.order_okbox[data-sku="' + product.ProductSkuNo + '"]').remove();
										postage_tmp[product.ProductNo] = elstring;
									}
								});
							}
						});
						$.each(postage_tmp, function(productNo, elstring) {
							var $elpk = $el.find(elstring);
							if(!$elpk.find('.order_okbox').length) {
								$elpk.remove();
							}
						});
						$el = $el.children()
					})();

					$(".productList").append($el);

					if(result.DiscountResult.MemberDiscountResult === null) {
						$('#Integral .ui-slider-handle').css({
							'margin-left': '-16px'
						});
						$('#slider').attr("disabled", false);
					} else {
						$('a[aria-labelledby="Memberlabel"]').attr('aria-valuenow', 'true');
						$("#User_Member").val('true').change();
						$('#Integral .ui-slider-handle').css({
							'margin-left': '-12px'
						});
						$('#slider').attr("disabled", true);
					}
					$('.givePresent .give').each(function() {
						var typefees = $(this).attr('type');
						if(typefees == '1') {
							$(this).hide().parent().css({
								'padding-left': '0'
							});
						}
					})

					var productPrice = (result.TotalPrice).toFixed(2);

					//计算可用积分上限(最多只能是productPrice的一半)
					// var maxValidScore = parseInt(productPrice * validScoreData.ExchangeConfig.Score / (validScoreData.ExchangeConfig.Fee * 2));
					var maxValidScore = parseInt(productPrice * validScoreData.ExchangeConfig.Score / (validScoreData.ExchangeConfig.Fee));

					if(maxValidScore < validScoreData.TotalScore) {
						validScoreData.TotalScore = maxValidScore;
					}
					var _remainder = validScoreData.TotalScore % validScoreData.ExchangeConfig.Score;
					var _actualtotalscore = validScoreData.TotalScore - _remainder;
					var _scoretodiscountfee = _actualtotalscore / validScoreData.ExchangeConfig.Score * validScoreData.ExchangeConfig.Fee;
					if(_actualtotalscore == 0) {
						$('#Integral').hide();
						$('.integral').html('0');
					} else {
						$('.integral').html(Math.floor(_actualtotalscore));
						$('.integralmomey').html(_scoretodiscountfee.toFixed(2));
					}

					if(result.DiscountResult.MemberDiscountResult === null) {
						var payFee = productPrice - allDiscountFee + allshoppingFee;
					} else {
						if($('#User_Member').attr('aria-valuenow') == 'true') {
							var payFee = productPrice - result.DiscountResult.MemberDiscountResult.DiscountFee + allshoppingFee;
						}
					}

					//支付金额
					$('#totalPrice').text(productPrice);
					$('#span_realpay_price').text(payFee);
					$('#span_realpay_price').attr("totalprice", payFee);

					calTotalPrice();

					if(!isShowAddr) $('#li_address').hide();

					//加载完毕
					// if (payFee >= 3000) {//大于3k不允许下单
					//     $(".loaderTipsHandler2").text("温馨提示:由于微信支付限制,订单总金额不能超过3000元,请分开下单,谢谢您的合作。");
					//     $(".loaderTipsHandler").hide();
					// } else {
					//     loaderStat.LoadSelectedProduct = true;
					// }

					loaderStat.LoadSelectedProduct = true; // 忽略3000元的限制

					loaderStat.LoadCouponTicketList = false;
					LoadCouponTicketList(orderProductList);
					loaderStat.LoadHongbaoTicketList = false;
					LoadHongbaoTicketList(orderProductList);
					setSubmitBtnStat();
				},
				command: 'Member.LoadSelectPromitionProtuct',
				parameter: {
					MemberAccount: '<%=CurrentMemberAccount%>'
				}
			});
			handler.nextPage();
		}

		//处理产品sku属性
		function GetSkuItemHtml(paramCode) {
			var skuString = "";
			try {
				var skuList = $.parseJSON(paramCode);
				$(skuList).each(function() {
					skuString += "<span>" + this.ItemName + "</span>";
				});
				return skuString;
			} catch(e) {}
		}

		var createOrderParam = {};

		function SubmitDone(result) {
			if(result) {
				var payInterface = "";
				//判断是否为到付
				if(createOrderParam.PaymentInterface === "NOPAY") {
					showTips("提交成功!正在跳转页面...", 1500, function() {
						location.href = "OrderList.aspx";
					});
				} else {
					//判断是否需要支付
					if(result.PayStatus == '1') {
						showTips("提交成功!", 500, function() {
							location.href = "orderlist.aspx";
						});
						return;
					}

					//调接口，跳转支付页面
					$("#mypage").executeCommand({
						successCallBack: function(result, totalCount) {
							//跳转支付
							location.href = result.PaymentUrl;
						},
						errorCallback: function(errorCode, msg) {
							showTips(msg);
						}
					}, 'Member.RequirePayOrder', {
						MemberAccount: '<%=CurrentMemberAccount %>',
						PaymentNo: result.PaymentNo,
						IsCheckPay: "0"
					});

				}
			}
		}
		//确认下单
		function submitOrder(el) {
			//数据没加载完
			if(!checkLoaderStat()) {
				return;
			}

			createOrderParam.UseSpecialDiscount = ($("#User_Member").val() == 'true') ? 1 : 0;

			//使用员工九折优惠
			if($("#User_Member").val() == 'false' && $("#slider").val() == 'true') {
				createOrderParam.Score = parseInt($(".integral").html());
			} else {
				createOrderParam.Score = 0;
			}

			$("#form_submit_order").find('[command-param]').each(function() {
				if($(this).attr('data-role') == 'controlgroup') {
					var val = '';
					$(this).find('input').each(function() {
						if(this.type == "radio") {
							if($(this)[0].checked == true) {
								val = $(this).val();
							}
						} else if(this.type == "checkbox") {
							if($(this)[0].checked == true) {
								val += $(this).val() + ",";
							}
						}
					});
					createOrderParam[$(this).attr('command-param')] = val;
				} else {
					createOrderParam[$(this).attr('command-param')] = $(this).val();
				}
			});

			var couponCode = $("#hid_coupon_code").val();
			var hongbaoCode = $('#page_hongbao').data('value');

			if(couponCode != '-1') {
				createOrderParam.CouponTicket = [couponCode];
			} else if(hongbaoCode && hongbaoCode.length) {
				createOrderParam.CouponTicket = hongbaoCode;
			} else {
				createOrderParam.CouponTicket = [];
			}

			if(isShowAddr) {
				if($("#hid_address").val() === '-1' || $("#hid_address").val() === '0' || $("#hid_address").val() === '') {
					showTips("请选择收货地址。");
					return false;
				}
			} else {
				$("#hid_address").val(-99);
			}

			if(calTotalPrice() != 0) {
				//获取支付类型
				var rdos = $("p[name=rdo_payment]");
				$(rdos).each(function() {
					if($(this).attr("isSelected") == '1') {
						createOrderParam.PaymentId = parseInt($(this).attr('id'));
					}
				});
				if(createOrderParam.PaymentId == undefined) {
					showTips("请选择支付方式。");
					return false;
				}
			} else {
				createOrderParam.PaymentId = "-1";
			}

			createOrderParam.AddressId = parseInt($("#hid_address").val());

			createOrderParam.Remark = $("#txt_remark").val();

			$(el).executeCommand({
				successCallBack: function(result, totalCount) {
					SubmitDone(result);
					$(el).button("disable");
				},
				errorCallback: function(errorCode, msg) {
					showTips(msg);
				}
			}, 'Member.CreateOrder', createOrderParam);
		}

		//  绑定控件
		// $('input[prop]', $('#AddressDetail')).bind('valuechange', function (event, param) {
		//     $(this).val(param.value);
		//     $(event.target).triggerHandler('valuechanged', param);
		//     return false;
		// });

		//保存地址成功
		function SaveAddressDone(result) {
			showTips("提交成功!", 500, function() {
				selectAddress();
			});
			if(result.Data.Id) {
				flushAddressList();
				setTimeout(function() {
					$('#div_address_list .boxlist div[address=' + result.Data.Id + ']', $("#AddressList")).click();
				}, 500);
			}
		}

		//加载地址列表
		function flushAddressList() {

			var handler = $('#div_address_list', $('#AddressList')).listviewHandler();
			handler.initialize({
				loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
				emptyHtml: '&nbsp;', //无记录时显示此html
				itemTemplate: '<div class="boxlist">' +
					'  <div class="left" address="{Id}" ><input name="rdo_select_address" id="rdo_select_address_{Id}" type="radio">' +
					'<label for="rdo_select_address_{Id}" ></label>' +
					' </div>' +
					' <div class="center" address="{Id}" >' +
					'<div class="text">{ProvinceName}{CityName}{AreaName}{Address}</div>' +
					'<p>{Receiver}<Span>{Phone}</Span></p>' +
					'</div>' +
					' <div class="right" editAddress="{Id}"><a href="javascript:void(0)" ><img src="images/bianji_icon.png"></a></div>' +
					' <div class="clear"></div>' +
					'</div>', //项模板
				pageIndex: 1, //页码（从1起算）
				pageSize: 100, //页大小
				totalCount: 999, //总记录数
				itemHandler: function(data, itemTemplate, container) { //数据各项处理
					if(data.Area == null) {
						data.Area = '';
					}
					return itemTemplate.format(data);
				},
				afterHandleResult: function(result, totalCount, container) {
					if(totalCount > 0) {
						$("#div_address_list").css("display", "block");
					}
					//修改地址
					$('#div_address_list .boxlist div[editaddress]', $("#AddressList")).unbind().bind('click', function() {

						jQuery.mobile.changePage($('#AddressDetail'));

						$('#AddressDetail [prop]').off('valuechange').on('valuechange', function(event, param) {
							$(this).val(param.value);
							$(event.target).triggerHandler('valuechanged', param);
							return false;
						});
						//loadMemberAddress
						loadAddressDetail($(this).attr('editaddress'));

						$("[command-param='AddressId']", $('#AddressDetail')).val($(this).attr('editaddress'));

					});
					//选择地址
					$('#div_address_list .boxlist div[address]', $("#AddressList")).unbind().bind('click',
						function() {
							//$("#rdo_select_address_" + $(this).attr("address")).trigger("click");
							//返回页面
							var addrHtml = "{Receiver},{Phone}<p>{ProvinceName}{CityName}{AreaName}{Address}</p>";
							$('#finalAddr').empty();
							var curAddrId = $(this).attr("address");
							$(result.List).each(function() {
								//alert(this.Id);
								if(curAddrId == this.Id) {
									$("#finalAddr").append(addrHtml.format(this));
									$("#hid_address").val(this.Id);
								}
							});
							$('#rdo_select_address_' + curAddrId).prop('checked', true).checkboxradio("refresh");
							setTimeout(function() {
								jQuery.mobile.changePage($('#mypage'));
							}, 250);
						});
					$('#div_address_list', $('#AddressList')).trigger("create");
				},
				command: 'Member.LoadAddressList',
				parameter: {
					MemberAccount: '<%=CurrentMemberAccount %>'
				}
			});
			handler.nextPage();
		}

		function loadAddressDetail(addressid) {
			var handler = $('#form_save_addr').loaderHandler();
			handler.initialize({
				command: 'Member.LoadAddressDetail',
				parameter: {
					AddressId: addressid,
					MemberAccount: '<%=CurrentMemberAccount %>'
				},
				beforeHandleResult: function(result, totalCount, container) {

					if(result && result.Data) {
						$('#AddressDetail select[Category=Province]').attr('default_val', result.Data.ProvinceCode);
						$('#AddressDetail select[Category=City]').attr('default_val', result.Data.CityCode);
						$('#AddressDetail select[Category=Area]').attr('default_val', result.Data.AreaCode);
					}
				},
				afterHandleResult: function(result, totalCount, container) {
					$('#AddressDetail select[Category]').addressCascade();
					$('#AddressDetail input[name=ckmr]').prop('checked', $('#addr_status').val() == '1').checkboxradio("refresh");
				}
			});
			handler.load();
		}

		//点击选择地址，跳转地址列表
		function selectAddress() {
			flushAddressList();
			transferToPage('AddressList');
		}

		//新增地址
		function newAddress() {
			//重置地址详情
			$('#AddressDetail [command-param]').each(function() {
				if($(this).attr('command-param') != 'MemberAccount') {
					$(this).val('');
				}
			});
			$('#AddressDetail [command-param=AddressId]').val(0);
			jQuery.mobile.changePage($('#AddressDetail'));
			$('#AddressDetail select[Category=Province]').attr('default_val', '-1');
			$('#AddressDetail select[Category=City]').attr('default_val', '-1');
			$('#AddressDetail select[Category=Area]').attr('default_val', '-1');
			$('#AddressDetail select[Category]').addressCascade();

			$("#hid_address").val(0);
			$('#ckb_default_address').prop('checked', false).checkboxradio("refresh");
			//$('#form_save_addr').isValid();
			$('#form_save_addr').validator("cleanUp");
		}

		//跳转页面
		function transferToPage(pageid) {
			if(checkLoaderStat()) {
				jQuery.mobile.changePage($('#' + pageid));
			}
		}
		//选择支付方式
		function selectPayType(el) {
			$(el).attr('isSelected', '1');
			$("#my_paytypes").html($(el).attr("PaymentName"));
			jQuery.mobile.changePage($('#mypage'));
		}

		//选择优惠券,type=4只能使用一张优惠券，=5可使用多张优惠券
		function selectCoupon(el, frist) {

			_couponStatu = true;
			$("#span_coupon").html($(el).attr("couponname"));
			$("#hid_coupon_code").val($(el).attr("couponcode"));
			$("#hid_coupon_code").attr("coupontype", $(el).attr("type"));
			$('.position').text('');
			jQuery.mobile.changePage($('#mypage'));
			if($(el).attr("couponcode") != '-1' && ($(el).attr("type") == '4' || $(el).attr("type") == 'voucher')) {
				$("#span_coupon_amount").fadeIn();
				$("#slider").slider("disable");
				$('#span_realpay_price').attr('integralmomey', 0);
				$('#Integral label,.integralmomey').css({
					'color': '#d7d7d7'
				});
				$('#Memberlabel').css({
					'text-decoration': 'line-through',
					'color': '#d7d7d7'
				});
				$("#User_Member").slider("disable");
				$('#Label1').css({
					'text-decoration': 'line-through'
				});
				calCoupon = true;
				$('#li_hongbao').children('a').removeAttr('onclick').addClass('Cantclick').css({
					'text-decoration': 'line-through'
				});
				$('#span_hongbao').css({
					'text-decoration': 'line-through'
				});
				valuation();
			} else if($(el).attr("type") == 'exchange') {
				$("#span_coupon_amount").fadeIn();
				$("#slider").slider("disable");
				$('#span_realpay_price').attr('integralmomey', 0);
				$('#Integral label,.integralmomey').css({
					'color': '#d7d7d7'
				});
				$('#Memberlabel').css({
					'text-decoration': 'line-through',
					'color': '#d7d7d7'
				});
				$("#User_Member").slider("disable");
				$('#Label1').css({
					'text-decoration': 'line-through'
				});
				calExchange = true;

				$('#li_hongbao').children('a').removeAttr('onclick').addClass('Cantclick').css({
					'text-decoration': 'line-through'
				});
				$('#span_hongbao').css({
					'text-decoration': 'line-through'
				});

				valuation();
			} else {
				realPayPriceSpan.attr("couponcut", '0');
				$("#span_coupon_amount").fadeOut();
				$("#font_coupon").html("0");
				calTotalPrice();
				if(!frist) {
					$("#slider").slider("enable").slider("refresh");
					$('#slider').attr("disabled", false);
					$('#Label1').css({
						'text-decoration': 'none',
						'color': '#333'
					});
					$('.integralmomey').css({
						'color': "red"
					})
				};
				$('#Memberlabel').css({
					'text-decoration': 'none',
					'color': '#000'
				});
				$("#User_Member").slider("enable").slider("refresh");
				$('#User_Member').attr("disabled", false);

				$('#li_hongbao').children('a').attr('onclick', 'transferToPage(\'page_hongbao\')').removeClass('Cantclick').css({
					'text-decoration': 'none'
				});
				$('#span_hongbao').css({
					'text-decoration': 'none'
				});
			}
		}
		//选择使用积分  计算折扣金额
		function clickScoreCheckBox(el) {
			if($(el).prop("checked")) {
				$("#txt_score_count").val('');
				$("#div_score_count").fadeIn();
			} else {
				$("#txt_score_count").val('');
				$("#div_score_count").fadeOut();
			}
			realPayPriceSpan.attr("scorecut", '0');
			$("#font_score").html('0');
			$("#span_score_amount").fadeOut();
			calTotalPrice();
			return false;
		}
		//输入积分 计算抵扣金额
		function inputScoreCount(el) {
			if(isNaN($(el).val())) {
				showTips("请输入正确的积分数。");
				realPayPriceSpan.attr("scorecut", '0');
				$("#font_score").html('0');
				$("#span_score_amount").fadeOut();
				return false;
			}
			if(parseInt($(el).val()) > parseInt('<%=CurrentMember.Score %>')) {
				showTips("您积分只有 <%=CurrentMember.Score %>");
				realPayPriceSpan.attr("scorecut", '0');
				$("#font_score").html('0');
				$("#span_score_amount").fadeOut();
				return false;
			}
			if($(el).val() == '') {
				realPayPriceSpan.attr("scorecut", '0');
				$("#font_score").html('0');
				$("#span_score_amount").fadeOut();
				calTotalPrice();
				return false;
			}
			calScore = true;
			valuation();
			$("#span_score_amount").fadeIn();
		}
		var calCoupon = false;
		var calScore = false;
		var calExchange = false;
		var realPayPriceSpan = $("#span_realpay_price");
		//预计实付金额
		function valuation() {
			if(calCoupon) {

				var couponCode = $("#hid_coupon_code").val();
				var hongbaoCode = $('#page_hongbao').data('value');

				if(couponCode != '-1') {
					var CouponTicket = [couponCode];
					$("#span_coupon_amount .MomeyName").text('优惠券');
				} else if(hongbaoCode && hongbaoCode.length) {
					var CouponTicket = hongbaoCode;
					$("#span_coupon_amount .MomeyName").text('红包');
				} else {
					var CouponTicket = [];
					$("#span_coupon_amount .MomeyName").text('优惠券');
				}

				$("#div_score_count").executeCommand({
					successCallBack: function(result, totalCount) {
						var DiscountFee = 0;
						for(var i = 0; i < result.Data.length; i++) {
							DiscountFee += result.Data[i].DiscountFee;
						}
						DiscountFee = Number(DiscountFee.toFixed(2));
						realPayPriceSpan.attr("couponcut", DiscountFee);
						$("#font_coupon").html(DiscountFee);
						// $("#span_coupon_amount").fadeIn();
						calTotalPrice();
						calCoupon = false;
					},
					errorCallback: function(errorCode, msg) {
						showTips(msg);
						calCoupon = false;
					}
				}, 'Member.ShopComputeCoupon', {
					MemberAccount: '<%=CurrentMemberAccount %>',
					CouponTicket: CouponTicket,
					ProductList: orderProductList
				});
			}
			if(calExchange) {
				$("#div_score_count").executeCommand({
					successCallBack: function(result, totalCount) {
						realPayPriceSpan.attr("couponcut", result.Data.DiscountFee * -1);
						$("#font_coupon").html("￥" + (result.Data.DiscountFee * -1));
						// $("#span_coupon_amount").fadeIn();
						calTotalPrice();
						calExchange = false;
					},
					errorCallback: function(errorCode, msg) {
						showTips(msg);
						calExchange = false;
					}
				}, 'Member.ExchangeCouponCalPriceFactor', {
					MemberAccount: '<%=CurrentMemberAccount %>',
					JsonParameter: $("#hid_coupon_code").val()
				});
			}
			if(calScore) {
				$("#div_score_count").executeCommand({
					successCallBack: function(result, totalCount) {
						realPayPriceSpan.attr("scorecut", result.Factor);
						$("#font_score").html((result.Factor * -1));
						//     $("#span_score_amount").fadeIn();
						//计算总实付
						calTotalPrice();
						calScore = false;
					},
					errorCallback: function(errorCode, msg) {
						showTips(msg);
						calScore = false;
					}
				}, 'Member.ScoreCalPriceFactor', {
					MemberAccount: '<%=CurrentMemberAccount %>',
					JsonParameter: $("#txt_score_count").val()
				});
			}
		}

		function calTotalPrice() {
			//计算总实付
			var realpay = parseFloat(realPayPriceSpan.attr("scorecut")) + parseFloat(parseFloat(realPayPriceSpan.attr("totalprice") - realPayPriceSpan.attr("couponcut") - realPayPriceSpan.attr("integralmomey")));

			//运费
			realpay += parseFloat($('#shipPrice').text());

			realpay = realpay < 0 ? 0 : realpay.toFixed(2);
			//判断订单金额是否为0，是则隐藏支付类型选择
			if(realpay == 0) {
				$("#div_payment_type>#choosepaymenttype").fadeOut();
				$("#div_payment_type>#nopaymenttype").fadeIn();
			} else {
				$("#div_payment_type>#nopaymenttype").fadeOut();
				$("#div_payment_type>#choosepaymenttype").fadeIn();
			}
			realPayPriceSpan.html(realpay);
			return realpay;
		}

		function loadPayTips() {
			var handler = $('.loaderTipsHandler').loaderHandler();
			handler.initialize({
				command: 'Pub.LoadModuleData',
				parameter: {
					Id: 'SHOP_HELP_SUMMITORDERTIPS'
				}
			});
			handler.load();
		}

		$(document).ready(function() {
			$.cookie('After', $.cookie('CurrentPage'));
			$.cookie('CurrentPage', 'order');
			var After = $.cookie('After');
			var Current = $.cookie('CurrentPage');
			//保存统计记录
			var path = 'order|path|' + Current + '|' + After;
			_hmt.push(['_trackEvent', path, 'enter', 'sunmitorder']);
			_hmt.push(['_trackEvent', 'page', 'view', 'sunmitorder']);

		});

		function ChangeEvent() {

			var _sliderV = $("#slider").val();
			//使用了员工九折
			if($('#slider').attr('disabled') == true || $("#User_Member").val() == 'true') {
				$('#Integral .ui-slider-handle').css({
					'margin-left': '-12px'
				}).attr('aria-valuenow', 'false');
				$('#Integral .ui-slider-label,#Integral .ui-slider-label-b,#Integral .ui-slider-label-a').css({
					'width': '100%',
					'background-color': '#ececec'
				});
				return;
			}
			var _mey = Number($('.integralmomey').html());
			if(_sliderV == 'true') {
				$('#li_coupon').children('a').removeAttr('onclick').addClass('Cantclick').css({
					'text-decoration': 'line-through'
				});
				if(_couponStatu) {
					selectCoupon('.boxlist');
				};
				$('#span_coupon').html(_coupons);
				$('#Memberlabel').css({
					'text-decoration': 'line-through',
					'color': '#d7d7d7'
				});
				$('#span_coupon').css({
					'text-decoration': 'line-through'
				});
				$('#Integral .ui-slider-label,#Integral .ui-slider-label-b,#Integral .ui-slider-label-a').css({
					'width': '100%',
					'background-color': '#f9384d'
				});
				$('#Integral .ui-slider-handle').css({
					'margin-left': '-12px'
				});
				$('#Integral_Momey').fadeIn();
				$('#span_realpay_price').attr('integralmomey', _mey);
				$("#User_Member").slider("disable");
				$('#li_hongbao').children('a').removeAttr('onclick').addClass('Cantclick').css({
					'text-decoration': 'line-through'
				});
				$('#span_hongbao').css({
					'text-decoration': 'line-through'
				});
				calTotalPrice();
			} else {
				$('#li_coupon').children('a').attr('onclick', 'transferToPage(\'page_coupon\')').removeClass('Cantclick').css({
					'text-decoration': 'none'
				});
				$('#Integral .ui-slider-label,#Integral .ui-slider-label-b,#Integral .ui-slider-label-a').css({
					'width': '100%',
					'background-color': '#ececec'
				});
				$('#Integral .ui-slider-handle').css({
					'margin-left': '-16px'
				});
				$('#Integral_Momey').fadeOut();
				$('#Memberlabel').css({
					'text-decoration': 'none',
					'color': '#000'
				});
				$('#span_realpay_price').attr('integralmomey', 0);
				$('#User_Member').attr('aria-valuenow') == 'false';
				$("#User_Member").slider("enable").slider("refresh");
				$('#User_Member').attr("disabled", false);
				$('#span_coupon').css({
					'text-decoration': 'none'
				});
				$('#li_hongbao').children('a').attr('onclick', 'transferToPage(\'page_hongbao\')').removeClass('Cantclick').css({
					'text-decoration': 'none'
				});
				$('#span_hongbao').css({
					'text-decoration': 'none'
				});
				calTotalPrice();
			};
		}
	</script>
</asp:Content>